<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>${title}</title>
<%@include file="/WEB-INF/templates/common/common.jsp"%>
<script type="text/javascript" src="${basePath}/static/jqPaginator/jqPaginator.js"></script>
<script  type="text/javascript" src="${basePath}/static/layer/layer.js"></script>
<link href="${basePath}/static/layer/layer_style.css" rel="stylesheet" type="text/css">

</head>
<body>

	<!--头部-->
	<%@include file="/WEB-INF/templates/common/header.jsp"%>
	<!------导航条-->
	<%@include file="/WEB-INF/templates/common/navigation.jsp"%>

	<div class="list_main lay_out">
		<div class="list_DH">
			<%@include file="/WEB-INF/templates/common/printnav.jsp"%>
		</div>
		<div class="list_NR">
			<div class="loc">
				<h3>缺项统计查询</h3>
			</div>
			 <div class="list_con_table">
           <div class="search_table">
                <ul class="clearfix" style="margin-bottom:0;">
		               <li class="Label_1" style="width:12%;">出院日期：&nbsp;</li>
                       <li class="Label_4" style="text-align:left;padding-left:3px;width:32%">
                    	<input class="Wdate input" style="width:44%;" type="text"  name='startTime' id='outHospitalStartDate' value='' onFocus="WdatePicker()" />
                    	<span>&nbsp;-&nbsp;</span><input class="Wdate input" type="text" style="width:44%;"  name='endTime' id='outHospitalEndDate' value='' onFocus="WdatePicker()" />
                       </li>
		               <li class="Label_1" style="width:12%">ID号：&nbsp;</li>
		               <li class="Label_2" style="width:15%">
		               	<input class="input_box" type="text"  id="mrId" value='' />
		               </li>
		               <li class="Label_1" style="width:12%">住院次数：&nbsp;</li>
		               <li class="Label_2" style="width:15%">
		               	<input class="input_box" type="text" id="visitNumber" value='' />
		               </li>
		               <li class="Label_5">
		                        <div class="right" style="text-align:right">
		                            <a id="Add" onclick="init(1,10)">查询</a>
		                        </div>
		               </li>    
                </ul>
            </div> 
             <table class="Search_tableList" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="tdLabel_4">姓名</td>
                    <td class="tdLabel_4">ID号</td>
                    <td class="tdLabel_4">住院次数</td>
                    <td class="tdLabel_4">出院科室</td>
                    <td class="tdLabel_4">出院日期</td>
                    <td class="tdLabel_4" style="color:red">*缺项</td>
                </tr>
                <tr id="loading" style="height:50px;display:none">
	             <td colspan="6" align="center" ><img src="${basePath}/static/layer/skin/default/loading-2.gif"></td>
	            </tr>
                <tbody id="tbody">
	               
                </tbody>
   
            </table>
        </div>
        <div class="pageList">
            <ul class="pagination clearfix" id="page_plus"></ul>
            <div class="pagination">
                <div>总共：<b id="totalPage">0</b> 条信息    当前页是第 <b id="currentPage">0/0</b>　页</div>
            </div>
        </div>
    </div>
	</div>
	<!------页脚部分-->
	<%@include file="/WEB-INF/templates/common/footer.jsp"%>
	
	
	<!-- JS -->
	<script type="text/javascript">
	
	 function init(pageNo,pageSize){
	    	var  outHospitalStartDate=$("#outHospitalStartDate").val();
	    	var  outHospitalEndDate=$("#outHospitalEndDate").val();
	    	var  mrId=$("#mrId").val();
	    	var  visitNumber=$("#visitNumber").val();
	    	/* if((name==null||name=="")&&(idCard==""||idCard==null)&&(mrId==""||mrId==null)&&
					(outHospitalOfficeId==""||outHospitalOfficeId==null)&&(outHospitalStartDate==""||outHospitalStartDate==null)&&(outHospitalEndDate==""||outHospitalEndDate==null)&&
					(outHospitalTypeIds==""||outHospitalTypeIds==null)){
				layer.alert('请至少输入一个查询条件!', {icon: 0});
				return;
			} */
			
			jQuery.support.cors = true;
	    	$.ajax({
	    		type:'get',
	    		url:"${corePath}/statistics/ajax_lacunaStatistics",
	    		data:{outHospitalStartDate:outHospitalStartDate,outHospitalEndDate:outHospitalEndDate,mrId:mrId,visitNumber:visitNumber,
	    			currentPage:pageNo,pageSize:pageSize
	    			 },
	    		beforeSend:function(){
	 				$("#tbody").html("");
	 				$("#loading").show();
	 			},
	 			//dataType:'jsonp',
	    		success:function(data){
	    			    $("#loading").hide();
	    			   // console.log(data)
	    			    if(data.success){
	    				var hospitalNotes=data.data.hospitalizationNotes;
	    				
	    				var len=hospitalNotes.length;
	    				if(len>0){
	    					var totalCounts=data.data.count;
	    					
	    					page(pageNo,totalCounts);
	    					var html='';
	        				for(var i=0;i<len;i++){
	        					var obj=hospitalNotes[i];
	        					html+="<tr data-guid="+obj.first_level_medical_guid+">"+
	    	    	                
	    	    	                  "  <td class='tdLabel_5'>"+(obj.name==undefined?'':obj.name)+"</td>"+
	    	    	                  "  <td class='tdLabel_5'>"+(obj.mr_id==undefined?'':obj.mr_id)+"</td>"+
	    	    	                  "  <td class='tdLabel_5'>"+(obj.visit_number==undefined?'':obj.visit_number)+"</td>"+
	    	    	                  "  <td class='tdLabel_5'>"+(obj.outOfficeName==undefined?'':obj.outOfficeName)+"</td>"+
	    	    	                  "  <td class='tdLabel_5'>"+(obj.out_hospital_date==undefined?'':obj.out_hospital_date)+"</td>"+
	    	    	                  "  <td class='tdLabel_5'>"+(obj.lacunaContent==undefined?'':obj.lacunaContent)+"</td>"+ 
	    	    	                  //"  <td class='tdLabel_5'>"+
	    	    	                 // "<a class='int' onclick='searchScan(this)'>扫描</a>&nbsp;&nbsp;"+
	    	    	                 // "   <a class='int' style='margin-left:0;' onclick='upload(this)'>导入</a></td>"+
	    	    	                  "</tr>";
	        					
	        				}
	        				$("#tbody").html("").html(html);
	    				}else{
	    					layer.alert('查询数据为空!', {icon: 5});
	    				    $("#tbody").html("");
	                        $("#currentPage").html("0/0");
	    					$("#totalPage").html("0");
	    					$("#page_plus").html("");
	    				}

	    			}else{
	    				layer.alert(data.msg, {icon: 5});
					    $("#tbody").html("");
	                    $("#currentPage").html("0/0");
						$("#totalPage").html("0");
						$("#page_plus").html(""); 
	    			} 
	    		}
	    	})
	    }
	    
	  function page(currentPage,totalCounts){
	    	
	        var pageSize = 10;
	        var visiblePages = 5; //设置最多显示的页码数
	        var totalPages = Math.ceil(totalCounts/pageSize);
	        $('#page_plus').jqPaginator({
	            totalCounts: totalCounts,
	            pageSize:pageSize,
	            visiblePages: visiblePages,
	            currentPage: currentPage,

	            first:'<li class="first"><a href="javascript:void(0);">首页</a></li>',
	            prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
	            next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
	            last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
	            page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
	            onPageChange: function (num,type) {
	            	 if(type !='init'){
	            		 init(num,pageSize);
	                 }
	            	
	                $("#totalPage").html(totalCounts);
	                $("#currentPage").html(num+"/"+totalPages);
	            }
	        });

	    }	
	</script>
</body>
</html>

